package com.glink.common.exception;

import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;

/**
 * @author rencl
 * The Base Common Exception
 * Created by rencl on 2017/8/1.
 */
@Setter
@Getter
public abstract class AbstractErrorException extends Exception {
    private String errorCode;
    private String lan;
    private String[] errorDetails = null;

    protected AbstractErrorException() {
    }

    protected AbstractErrorException(String errorCode, String lan, String[] errorDetails) {
        super(errorCode);
        this.errorCode = errorCode;
        this.lan = lan;
        this.errorDetails = errorDetails;
    }

    protected AbstractErrorException(String errorCode, String lan) {
        this.errorCode = errorCode;
        this.lan = lan;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this)
                .appendSuper(super.toString())
                .append("errorCode", errorCode)
                .append("lan", lan)
                .append("errorDetails", errorDetails)
                .toString();
    }
}
